package com.woniuxy.finance.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.woniuxy.commons.utils.ResStatus;
import com.woniuxy.commons.utils.ResponseResult;
import com.woniuxy.finance.dao.SettlementDao;
import com.woniuxy.finance.entity.Deal;
import com.woniuxy.finance.entity.Settlement;
import com.woniuxy.finance.entity.Transfer;
import com.woniuxy.finance.service.SettlementService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

/**
 * @ClassName SettlementServiceImpl
 * @Description TODO
 * @Author wxy
 * @Date 2022/6/10 14:31
 * @Version 1.0
 */
@Service
public class SettlementServiceImpl implements SettlementService {

    @Resource
    private SettlementDao settlementDao;

    @Override
    public ResponseResult<List<Settlement>> findAll() {
        List<Settlement> all = settlementDao.findAll();
        return new ResponseResult<>(200,"查询成功",all,ResStatus.SUCCESS);
    }

    @Override
    public BigDecimal unsettleCostSum() {
        BigDecimal money = settlementDao.unsettleCostSum();
        return money;
    }


    @Override
    public ResponseResult<List<Settlement>> findAllByWeek() {

        List<Settlement> daysContext = settlementDao.findAllByWeek();
        return new ResponseResult<>(200,"查询成功",daysContext,ResStatus.SUCCESS);
    }

    @Override
    public ResponseResult<List<Settlement>> findAllByMonth() {
        List<Settlement> monthContext = settlementDao.findAllByWeek();
        return new ResponseResult<>(200,"查询成功",monthContext,ResStatus.SUCCESS);
    }

    @Override
    public ResponseResult<List<Settlement>> findAllByDate(String date) {
        List<Settlement> all = settlementDao.findAllByDate(date);
        return new ResponseResult<>(200,"查询成功",all,ResStatus.SUCCESS);
    }


}
